package com.econ.powercloud.ems.controller.lowpressure;

import com.econ.powercloud.common.base.facade.pojo.MsgResult;
import com.econ.powercloud.ems.common.enums.DeviceType;
import com.econ.powercloud.ems.controller.ApiBaseController;
import com.econ.powercloud.ems.pojo.*;
import com.econ.powercloud.ems.service.biz.FlashNewDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author : zjf
 * @Description : 这里的接口都是高压特有的
 * @Date : 2022/7/20 15:23
 * @Modified by : zjf
 */
@RestController
@Api(tags ="低压实时数据查询")
@RequestMapping(value = "/api/v2/low/flashData")
public class LowFlashNewDataController extends ApiBaseController {

    @Autowired
    private FlashNewDataService flashNewDataService;

    @GetMapping(value = "getPCUYcDataByDeviceCode")
    @ApiOperation(value=" 根据PCU设备Code,获取PCU的遥测信息", notes=" 根据PCU设备Code,获取PCU的遥测信息")
    @ApiImplicitParam(name = "deviceCode", value = "设备id", required = true, dataType = "String")
    public MsgResult<List<List<FlashVO>>> getPCUYcDataByDeviceCode(@RequestParam(value = "deviceCode") String deviceCode){
        return successHandler(flashNewDataService.getDeviceTwoDimensionalYcData(deviceCode));
    }

    @GetMapping(value = "getPCUYxDataByDeviceCode")
    @ApiOperation(value=" 根据PCU设备code,获取PCU的遥信数据", notes="根据PCU设备code,获取PCU的遥信数据")
    @ApiImplicitParam(name = "deviceCode", value = "设备id", required = true, dataType = "String")
    public MsgResult<PCSOrPCUYxVO> getPCUYxDataByDeviceCode(@RequestParam(value = "deviceCode") String deviceCode){
        return successHandler(flashNewDataService.getPCSOrPCUYxDataByDeviceCode(deviceCode));
    }

    @GetMapping(value = "getStationBAMSStaticalData")
    @ApiOperation(value="获取储能站下的所有BAMS的统计数据", notes="获取储能站下的所有BAMS的统计数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "stationId", value = "储能站id", required = true, dataType = "String")
    })
    public MsgResult<List<FlashVO>> getStationBAMSStaticalData(@RequestParam(value = "stationId") String stationId){
        return successHandler(flashNewDataService.getLowStationBAMSStaticalData(stationId));
    }

    @GetMapping(value = "getBAMSYcData")
    @ApiOperation(value="获取BAMS遥测数据", notes="获取BAMS遥测数据")
    @ApiImplicitParam(name = "deviceCode", value = "设备id", required = true, dataType = "String")
    public MsgResult<List<List<FlashVO>>> getBMUYcData(@RequestParam(value = "deviceCode") String deviceCode){
        return successHandler(flashNewDataService.getDeviceTwoDimensionalYcData(deviceCode));
    }

    @GetMapping(value = "getBAMSYxData")
    @ApiOperation(value="获取BAMS遥信数据", notes="获取BAMS遥信数据")
    @ApiImplicitParam(name = "deviceCode", value = "设备id", required = true, dataType = "String")
    public MsgResult<BMUYxVO> getBMUYxData(@RequestParam(value = "deviceCode") String deviceCode){
        return successHandler(flashNewDataService.getBamsOrBmuYxData(deviceCode));
    }

    @GetMapping(value = "getBMSClusterData")
    @ApiOperation(value="获取BMS下所有簇的实时数据", notes="获取BMS下所有簇的实时数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "stationId", value = "储能站id", required = true, dataType = "String"),
            @ApiImplicitParam(name = "equipmentId", value = "储能装置id", required = false, dataType = "String")
    })
    public MsgResult<List<ClusterKindVO>> getBMSClusterData(@RequestParam(value = "stationId") String stationId,
                                                            @RequestParam(value = "equipmentId",required = false) String equipmentId){
        return successHandler(flashNewDataService.getLowBMSClusterData(stationId,equipmentId));
    }

    @GetMapping(value = "getProtectDeviceInfo")
    @ApiOperation(value="获取保护设备数据", notes="获取保护设备数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "stationId", value = "储能站id", required = true, dataType = "String"),
            @ApiImplicitParam(name = "equipmentId", value = "储能装置id", required = true, dataType = "String")
    })
    public MsgResult<List<ProtectDeviceVO>> getProtectDeviceInfo(@RequestParam(value = "stationId") String stationId,
                                                                 @RequestParam(value = "equipmentId")String equipmentId){
        return successHandler(flashNewDataService.getProtectDeviceInfo(stationId,equipmentId));
    }

}
